<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css" />
    <style>
        body {
            margin: 0;
            background-color: #f5f5f5;
        }

        #header_top {
            background: #fff;
        }

        #header_top .aui-icon-left,
        #header_top .aui-title,
        #header_top .aui-icon-search,
        #header_top .aui-pull-right .aui-iconfont {
            color: #333;
        }

        .con_top {
            font-size: 0.6rem;
            color: #999;
            padding: 0.25rem 0.75rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" id="header_top">
        <a class="aui-pull-left aui-btn" onclick="goback()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">添加银行卡</div>

    </header>
    <div id="app" v-cloak>
        <div class="con_top">
            请绑定持卡人本人的银行卡
        </div>
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        持卡人
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" placeholder="请填写持卡人" v-model="name">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        卡号
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" placeholder="请填写卡号" v-model="bank_num">
                    </div>
                </div>
            </li>
        </ul>
        <button type="button" name="button" class="user_set_btn" @click="isCard()" style="border-radius: 1rem;">下一步</button>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../script/aui-slide.js"></script>
<script type="text/javascript">
    function goback() {
        api.closeWin()
    }
    apiready = function() {
        var app = new Vue({
            el: '#app',
            data: {
                token: '', // 当前页
                bank_num: '',
                name: '',
                data: []
            },
            created: function() {
                var $_this = this;
                $_this.token = $api.getStorage('token');
            },
            methods: {
                isCard:function() {
                  var $_this = this;
                  if($_this.name == '') {
                    api.toast({
                        msg: '持卡人不能为空',
                        duration: 1000,
                        location: 'bottom'
                    });
                    return;
                  }else if($_this.bank_num == '') {
                    api.toast({
                        msg: '银行卡号不能为空',
                        duration: 1000,
                        location: 'bottom'
                    });
                    return;
                  }
                  api.ajax({
                      url: window.Url.Freeucenter_getBankName,
                      method: 'post',
                      data: {
                          values: {
                              token: $_this.token,
                              bank_num: Base64.encode('UNO'+$_this.bank_num+'HACHA')
                          }
                      }
                  }, function(ret, err) {
                      if (ret.re == 1) {
                          $_this.data = ret.data
                          console.log(JSON.stringify(ret))
                          api.openWin({
                              name: 'bd_Card',
                              url: './bd_Card.html',
                              pageParam: {
                                name:$_this.name,
                                bank_num:Base64.encode('UNO'+$_this.bank_num+'HACHA'),
                                data:$_this.data
                              }
                          });
                      }else {
                        api.toast({
                            msg: JSON.stringify(ret.info),
                            duration: 1000,
                            location: 'bottom'
                        });
                      }

                  });
                }
            }
        })

    }
</script>

</html>
